/**
 * Copyright (c) 2019 xstgongyi.org
 * All rights reserved.
 */
package org.xstgongyi.eduaid.common;

/**
 * @author oldcrane<br/>
 * @created 2019-04-15
 */
public class PageHelper {

	private static final int DEFAULT_PAGE_SIZE = 20;

	public static int calcOffset(int pageNumber, int pageSize) {
		pageNumber = pageNumber > 0 ? pageNumber : 1;
		pageSize = pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE;
		int offset = (pageNumber - 1) * pageSize;
		return offset;
	}

}
